/**      
 * @file		fixGetProblem3.cpp
 * @description		This application fixes the problem with using cin's get member function.
 *			clearNewLine uses default parameters to set the arguments value if no
 *			arguments are passed to the function.
 *			clearNewLine is still generic enough that we can use it to pass arguments
 *			of type ifstream.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		3.0
 */
#include <iostream>
using namespace std;

/**
 * Clears the next new line character from the input stream.
 * @param	aInput the input stream to clear a new line from
 * @pre		the input stream has been initialized and is not at
 *		the EOF
 * @post	the next newline character has been removed from the
 *		stream
 */
void clearNewLine(istream& aInput = cin);

/**
 * @return zero if the application executes successfully
 */
int main() {
	cout << "Enter a number:\n";
	int number;
	cin >> number;

	cout << "Now enter a letter:\n";
	char ch;
	clearNewLine();			// notice no parameter
	cin.get(ch);

	cout << "The number is: '" << number << "'\n";
	cout << "The character is: '" << ch << "'\n";

	return 0;
}

void clearNewLine(istream& aInput) {
	char ch;
	do {
		aInput.get(ch);
	} while(ch != '\n');
}

